// custom-tab-bar/index.js
Component({
  data: {
    selected: 0,
    color: "#666666",          // 未选中颜色 - 柔和灰
    selectedColor: "#1890ff",  // 选中颜色 - 主题蓝
    list: [
      {
        pagePath: "/pages/index/index",
        text: "首页",
        icon: "wap-home"
      },
      {
        pagePath: "/pages/timeline/timeline",
        text: "历程",
        icon: "clock"
      },
      {
        pagePath: "/pages/guide/guide",
        text: "指南",
        icon: "guide"
      },
      {
        pagePath: "/pages/profile/profile",
        text: "我的",
        icon: "manager"
      }
    ]
  },

  attached() {
    // 组件实例被放入页面节点树后执行
  },

  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const url = data.path;
      
      wx.switchTab({
        url
      });
    }
  }
});
